import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;

import minidraw.standard.AbstractFigure;


public class FieldFigure extends AbstractFigure {
	
	Point origin;
	Dimension dimension;
	Field field;
	
	public FieldFigure(Field field, Point origin) {
		this.origin = origin;
		this.field = field;
		dimension = new Dimension(100, 100);
	}

	protected void basicMoveBy(int dx, int dy) {
		origin.translate(dx, dy);
	}

	@Override
	public Rectangle displayBox() {
		return new Rectangle(origin, dimension);
	}

	@Override
	public void draw(Graphics g) {
		g.setColor(Color.BLACK);
		g.setFont(new Font("Courier New", 10, 32));
		g.drawRoundRect(origin.x, origin.y, dimension.width-2, dimension.height-2, 5, 5);
		g.drawString(field.toString(), origin.x+(dimension.width/2)-10*field.toString().length(), origin.y+(dimension.height)/2+10);
	}

}
